package main

import (
	"bufio"
	"fmt"
	"os"
)
func main() {
	reader := bufio.NewReader(os.Stdin)
	fmt.Print("请输入一个字符串: ")
	input, _ := reader.ReadString('\n')
	input = input[:len(input)-2] 

	charCount := make(map[rune]int)
	for _, ch := range input {
		charCount[ch]++
	}

	minCount := len(input) + 1
	maxCount := 0
	minChar := rune(0)
	maxChar := rune(0)

	for ch, count := range charCount {
		if count < minCount {
			minCount = count
			minChar = ch
		}
		if count > maxCount {
			maxCount = count
			maxChar = ch
		}

	}
	fmt.Printf("出现次数最少的字符: '%c'，次数: %d\n", minChar, minCount)
	fmt.Printf("出现次数最多的字符: '%c'，次数: %d\n", maxChar, maxCount)
}

